import { createRouter, createWebHistory } from "vue-router";
import Login from "../views/Login.vue";
import Index from "../views/Index.vue";
import IndexRoot from "../views/IndexRoot.vue";
import ArticleList from "../views/ArticleList.vue";
import Article from "../views/Article.vue";
import User from "../views/User.vue";

const routes = [
  {
    path: "/",
    name: "index",
    component: Index,
    redirect: "/root",
    children: [
      {
        path: "/root",
        name: "indexRoot",
        component: IndexRoot,
      },{
        path: "/articleList",
        name: "articleList",
        component: ArticleList,
      },{
        path: "/user",
        name: "user",
        component: User,
      },{
        path: "/article",
        name: "article",
        component: Article,
      }
    ]
  },
  {
    path: "/login",
    name: "Login",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: Login,
  },
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});

export default router;
